import java.awt.Color;
import java.awt.Component;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.table.TableCellRenderer;


public class RowNumberRenderer implements TableCellRenderer {
	
	public RowNumberRenderer() {
		//label.setOpaque(true);
		//label.setForeground(Color.white);
		//label.setBackground(Color.gray);
	}
	@Override
	public Component getTableCellRendererComponent(JTable table, Object cell,
			boolean isSelected, boolean hasFocus, int row, int column) {
		final JLabel label=new JLabel();
		label.setHorizontalAlignment(SwingConstants.RIGHT);
		label.setText(cell.toString()+".");
		label.setOpaque(true);
		
		if(isSelected) {
			label.setBorder(BorderFactory.createLoweredBevelBorder());
			//label.setForeground(Color.white);
			//label.setBackground(Color.gray);
		} else {
			label.setBorder(BorderFactory.createRaisedBevelBorder());
		}
		return label;
	}

}
